/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package report.rservice;

import common.util.HibernateUtil;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;

/**
 *
 * @author User
 */
public class SERReport {
        public static List getYears(){
        Session session = HibernateUtil.getSession();
        Transaction transaction = session.beginTransaction();
        try {
            String hql = "from zobject.Year";
            Query query = session.createQuery(hql);
            List list = query.list();
            transaction.commit();
            return list;
        } catch (HibernateException e) {
            return null;
        } finally {
            HibernateUtil.closeSession();
            System.out.println("Closed Session in Year");
        }
    }
}
